#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 2e5 + 10;
//ll a[N];
void solve()
{
    string ans = "xxxxxxxx";
    string s[2];
    map<char, ll> mp;
    cin >> s[0] >> s[1];
    for (ll i = 0; i < 8;i++)
    {
        mp[s[0][i]]++;
    }
        for (ll i = 0; i < 8; i++)
        {
            if (s[0][i] == s[1][i])
            {
                ans[i] = 'g';
            }
            else if ((s[0][i] != s[1][i] )&&mp[s[1][i]])
            {
                ans[i] = 'y';
            }
            else {
                ans[i] = 'r';
            }
        }
        bool flag = 1;
        for (ll i = 0; i < 8;i++)
        {
            if(ans[i]!='g')
            {
                flag=0;
            }
        }
        cout << ans;
        cout << '\n';
        if(flag)
        {
            cout << "congratulations";
        }
        else {
            cout << "defeat";
        }
}
int main()
{
    ll t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}